import requests from '../requests';

//登录
export const login = (form) => {
    return requests({
         method: 'post', 
         url: '/user/login',
         data:form 
        })
}
//获取验证码
export const getImage= (form) => {
    return requests({
         method: 'get', 
         url: '/user/getImage',
        })
}
//获取供应商信息
// const pageSize=localStorage.getItem('records')
const token = localStorage.getItem('token')
export const get_supplier_data= (pageIndex,pageSize) => {
    return requests({
        method: 'get', 
        url: `/basedata/findAllSuppData/${pageIndex}/${pageSize}`,
        headers:{
            Authorization:token
            }
        })
}
// 删除供应商信息/basedata/changeSuppData
export const handleDelete_supplier_data= (id) => {
    return requests({
        method: 'get', 
        url: `/basedata/deleteSuppData/${id}`,
        headers:{
            Authorization:token
            }
        })
}
// 删除供应商信息/goods/findAllGoods/
export const handleEdit_supplier= (form) => {
    const token = localStorage.getItem('token')
    return requests({
        method: 'post', 
        url: `/basedata/changeSuppData`,
        data:{
            ...form
        },
        headers:{
            Authorization:token
            }
        })
}
// 删除供应商信息
export const get_goods_data= (pageIndex,pageSize) => {
    const token = localStorage.getItem('token')
    return requests({
        method: 'get', 
        url: `/goods/findAllGoods/${pageIndex}/${pageSize}`,
        headers:{
            Authorization:token
            }
        })
}
// 添加商品
export const add_goods= (form) => {
    const token = localStorage.getItem('token')
    return requests({
        method: 'post', 
        url: `/goods/addGoods`,
        data:{
            ...form
        },
        headers:{
            Authorization:token
            }
        })
}

